package com.youlai.system.mapper;

import com.youlai.system.model.entity.Attendancerecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.youlai.system.model.entity.Employ;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zhi1
 * @since 2024-05-28
 */
@Mapper
public interface AttendancerecordMapper extends BaseMapper<Attendancerecord> {

    @Update("update attendancerecord set adt_statu = #{attendancerecord.adtStatu} where user_id = #{attendancerecord.userId} and `day` = #{today} ")
    void updateDay(Attendancerecord attendancerecord, Integer today);


    @Update("update attendancerecord set adt_statu = #{adtStatu} where user_id = #{userId} and day = #{day}")
    boolean updateStatusByUserIdAndDay(Attendancerecord attendancerecord);

    @Select("SELECT * FROM attendancerecord WHERE `day` = #{datate} AND user_id = #{lastEmploy}")
    Employ selectIsExitLastData(int datate, int lastEmploy);

    @Select("SELECT * FROM attendancerecord WHERE `day` = '`day`' AND user_id = 60")
    Attendancerecord selectSameAttendande();

    @Select("SELECT user_id,adt_statu FROM attendancerecord WHERE `day` = #{today}")
    List<Attendancerecord> selectTodayList(int today);



    void insertBatch(List<Attendancerecord> records);

    void batchUpdate(List<Attendancerecord> recordsToUpdate, int today);
}
